<include file="Public/head"/>
<link href="__PUBLIC__/qwadmin/css/shen/shen.css" rel="stylesheet" type="text/css" />

<body class="no-skin">
<style>
body .demo-class .layui-layer-title{background:#6495ED; color:#fff; border: none;}
body .demo-class .layui-layer-btn{border-top:1px solid #E9E7E7}
body .demo-class .layui-layer-btn a{background:#333;}
body .demo-class .layui-layer-btn .layui-layer-btn1{background:#999;}

body th{
    color:#4F94CD;
    font-size:15px;
}
body td{
    font-size:14px;
}

#tet th{
    text-align: center;
}
#tet td{
    text-align: center;
}

#divv input{
    margin:0px 5px;
}
.dds input{
    margin:0px 5px;
}


.sp {
    border:1px solid #ccc;
    border-radius:50px;
    /*margin-top:30px;*/
}
.sp ul{
    margin-top:20px;
}
.sp ul li{
     float:left;
    margin:3px 10px;
    font-size:15px; 
    margin-left:28px;
}

.sp ul li button{
    width:140px;
    height:40px;
    border:1px solid #ccc;
    border-radius:50px;
}

#xxx ul{
    float:left;
    margin-top:5%;
}

#xxx ul li{
    float:left;
    padding: 5px 15px;
    margin-left:8px;
    font-size:15px;

}
.qyyy{
    text-align: :center;
}

</style>
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>
                

               <!--  <div style="margin-top:10px;float:right;">
                    <button onclick="ctong()" class="btn-success" style="height:30px;border-radius:20px;">查看所有通过</button>
                    <button onclick="cju()" class="btn-danger" style="height:30px;border-radius:20px;">查看所有拒绝</button>
                </div> -->




                <!-- 急性行政物资审核  END -->
             
                    <?php if($lei == '行政'): ?>
                        <input type="button" value="部门临时急性物品审批" style="margin-top:10px;background-color:#fff;border:2px solid #46A3FF;color:#46A3FF;height:40px;width:200px;font-size:17px;box-shadow: 3px 3px 10px #46A3FF;" onclick="h()">&nbsp&nbsp&nbsp&nbsp
                        <input type="button" value="公司临时急性物品审批" style="margin-top:10px;background-color:#fff;border:2px solid #46A3FF;color:#46A3FF;height:40px;width:200px;font-size:17px;box-shadow: 3px 3px 10px #46A3FF;" onclick="g()">
                    <?php else: ?>
                        <?php if($lei == '财务'): ?>
                            <input type="button" value="部门临时急性物品审批" style="margin-top:10px;background-color:#fff;border:2px solid #46A3FF;color:#46A3FF;height:40px;width:200px;font-size:17px;box-shadow: 3px 3px 10px #46A3FF;" onclick="h()">&nbsp&nbsp&nbsp&nbsp
                            <input type="button" value="公司临时急性物品审批" style="margin-top:10px;background-color:#fff;border:2px solid #46A3FF;color:#46A3FF;height:40px;width:200px;font-size:17px;box-shadow: 3px 3px 10px #46A3FF;" onclick="g()">
                        <?php else: ?>
                            <?php if($lei == '总经理'): ?>
                                <input type="button" value="部门临时急性物品审批" style="margin-top:10px;background-color:#fff;border:2px solid #46A3FF;color:#46A3FF;height:40px;width:200px;font-size:17px;box-shadow: 3px 3px 10px #46A3FF;" onclick="h()">&nbsp&nbsp&nbsp&nbsp
                                <input type="button" value="公司临时急性物品审批" style="margin-top:10px;background-color:#fff;border:2px solid #46A3FF;color:#46A3FF;height:40px;width:200px;font-size:17px;box-shadow: 3px 3px 10px #46A3FF;" onclick="g()">
                            <?php else: ?>
                            
                            <?php endif ?>
                        <?php endif ?>
                    <?php endif ?>
                    
                     <!-- 行政物资审核 -->
                   <div class="row" style="margin-top:-50px">

                        <div class="widget-box" style="margin-top:70px;height:0px;">
                            <div class="widget-header">
                                <h4 class="widget-title" style="color:#1E90FF;">
                                    <label>                 
                                        <span class="lbl"></span>
                                    </label>
                                    <b style="color:red;">--{$title}--</b>
                                </h4>
                                <div class="widget-toolbar">
                                    <notempty name="v.children">
                                        <a href="#" data-action="collapse">
                                            <i class="ace-icon fa fa-chevron-up"></i>
                                        </a>
                                    </notempty>
                                </div>
                            </div>
                            <notempty name="v.children">
                                <div class="widget-body">
                                <?php if($dao == '3'): ?>
                                    <input type="button"  value="导出excel" class=" btn-info"  style="float:left;border-radius:25px;width:100px;margin-top:5px;" onClick="return export_excel();"    /><span style="float:left; width:20px;height:100%;">&nbsp;</span>
                                    <!-- <input type="button" value="查看公司月度申请" style="margin-top:10px;background-color:#fff;border:2px solid #32CD32;color:#32CD32;height:40px;width:150px;font-size:17px;box-shadow: 3px 3px 10px #32CD32;" onclick="ku()"> -->
                                <?php endif ?>
                                    <div style="float:right;margin-top:3px;margin-right:0px;">
                                        <input id="submit" class="btn btn-info" type="button" value="一键通过">
                                        <!-- <button>ju</button> -->
                                    </div>
                                    <div style="float:right;margin-top:3px;margin-right:20px;">
                                            <input onclick="ju()" class="btn btn-danger" type="button" value="一键拒绝">
                                            <!-- <button>ju</button> -->
                                    </div>
                                   <!--  <div style="float:right;margin-top:3px;margin-right:20px;">
                                        <input onclick="ju()" class="btn btn-danger" type="button" value="一键拒绝"> -->
                                        <!-- <button>ju</button> -->
                                    </div>
                                    <div class="widget-main row" style="height:100%;margin-top:2px;">
                                        <?php if(!empty($list)): ?>
                                                <!-- 行政物资审核 END -->
                                                <div>
                                               <!--  <table class="table " style="margin-top:5px;">
                                                    <tr>
                                                        <th class="center" style="font-size:25px;">预估总价格</th>
                                                    </tr>
                                                    <tr>
                                                        <td class="center " style="font-size:17px; color:red;"><b class="t">{$coun}</b> <b>/元</b></td>
                                                    </tr>
                                                </table> -->
                                                <!-- <h4 style="text-align:center;"><b>行政物资申请:</b></h4> -->
                                                <form id="form" method="post" action="{:U('Shenp/ytong')}">

                                                <table class="table table-bordered" style="margin-top:5px;">
                                                    <thead>
                                                        <tr>
                                                            <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                                            <th class="center">编号</th>
                                                            <!-- <th class="center">物品类别</th> -->
                                                            <!-- <th class="center">申请类型</th> -->
                                                            <th class="center">物品名称</th>
                                    
                                                            <th class="center">申请数量</th>
                                                            <th class="center">规格</th>
                                                            <!-- <th class="center">剩余库存</th> -->
                                                            <th class="center">预估单价</th>

                                                            <!-- <th class="center">总价格</th> -->
                                                            <th class="center">申请人</th>
                                                            <th class="center">所属部门</th>
                                                            <th class="center">申请时间</th>
                                                            <?php if(!empty($cao)): ?>
                                                                <th class="center">操作</th>
                                                            <?php endif ?>
                                                            
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                    <volist name="list" id="v">
                                                        <tr>
                                                            <td class="center">
                                                            <input class="uids" type="checkbox" name="uids[]" value="{$v['id']}">
                                                            </td>
                                                            <td class="center" id="ddi">{$v.id}</td>
                                                                                                             
                                                                                                 
                                                            <td class="center">{$v.wname}</td>                                                   
                                                            <?php if(empty($cao)): ?>
                                                                <td class="center">
                                                                <b>{$v.num}{$v.com}</b>
                                                                </td>
                                                            <?php else: ?>
                                                                <td class="center">
                                                                <b><input type="text" name="num" value="{$v.num}" style="width:50px;">{$v.com}</b>
                                                                </td>
                                                            <?php endif ?>
                                                            <td class="center">
                                                                
                                                                    {$v.xing}
                                                                
                                                            </td>
                                                            <?php if(empty($cao)): ?>
                                                                <td class="center"><b style="color:red;">{$v.unit}</b>    <b style="float:right;">/元</b>
                                                                </td>
                                                            <?php else: ?>
                                                                <td class="center"><b style="color:red;"><input type="text" name="unit" value="{$v.unit}" style="width:50px;color:red;"></b>    <b style="float:right;">/元</b>
                                                                </td>
                                                            <?php endif ?>
                                                          <!--   <td class="center"><b style="color:red;">{$v.zong} </b>    <b style="float:right;">/元</b> -->
                                                            </td>
                                                            <td class="center">{$v.uname}</td>
                                                            <td class="center">{$v.ment}</td>
                                                            <td class="center">{$v.time}</td>
                                                            <?php if(!empty($cao)): ?>
                                                                <td class="center"><input onclick="xiu({$v.id},this)" type="button" value="修改"></input></td>
                                                            <?php endif ?>

                                                            
                                                                
                                                          
                                                            
                                                        </tr>
                                                    </volist>
                                                    </tbody>
                                                </table>
                                                <div class="form-group qyyy" style="display:none;position:absolute;width:600px;height:200px;background-color:#E6E6FA;border:1px solid #ccc;box-shadow: 7px 7px 5px #888888;margin:-20% 30%;" id="qcenten">
                                                    <label for="exampleInputEmail1" style="margin-top:15px;"><b style="font-size:17px;">请写下拒绝原因:</b></label>  
                                                    <textarea class="form-control" rows="3" name="cent" style="width:90%;margin-left:30px;" placeholder="请输入拒绝缘由...."></textarea><br>
                                                    <input id="jusubmit" class="btn btn-danger" type="button" value="提交" style="width:200px;">
                                                    <input type="button" class="btn btn-info"  value="关闭" onclick="guan()">
                                                </div>
                                                <input type="hidden" name="ntype" value="1">
                                                 </form>
                                                <!-- 行政物资审核 END -->
                                                   {$page}
                                        <?php endif ?>
                                                </div>
                                      

                                    
                                    </div>
                                </div>
                            </notempty>
                        </div>
                    </div>
                <!-- 急性行政物资审核  END -->
            
            
           <!--  <div class="form-group yyy" style="display:none;position:absolute;width:600px;height:200px;background-color:#E6E6FA;border:1px solid #ccc;box-shadow: 7px 7px 5px #888888;top:30%;left:35%;" id="centen">
            <form action="" id="formid">
                <label for="exampleInputEmail1" style="margin-top:20px;"><b style="font-size:17px;">请写下拒绝原因:</b></label>  
                <textarea class="form-control" rows="3" name="cent" style="width:90%;margin-left:30px;" placeholder="请输入拒绝缘由...."></textarea><br>
                <input type="hidden" class="ii" name="id">
                <input type="hidden"  name="type" value="1">
                <input id="tiju" class="btn btn-danger" type="button" value="提交" style="width:200px;">
                <input type="button" class="btn btn-info"  value="关闭" onclick="guan()">
            </form>
            </div> -->


                


            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <!-- <include file="Public/footer"/> -->

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script src="__PUBLIC__/layer/layer.js"></script>
<script src="__PUBLIC__/jquery-1.7.2.min.js"></script>
<script>

//行政修改价格/单价
function xiu(id,obj)
{
    // console.log(obj);
    // 
    //询问框
    var unit = $(obj).parent().prev().prev().prev().prev().children().children().val();
    var num = $(obj).parent().prev().prev().prev().prev().prev().prev().children().children().val();
    // var com = $(obj).parent().prev().prev().prev().prev().text();
    // console.log(num);
    layer.confirm('确定修改么 ( ・◇・)？', {
      btn: ['确定','取消'] //按钮
    }, function(){
         $.ajax({
                url:"{:U('Shen/xiu')}",
                type: 'post',
                data:{'id':id,'unit':unit,'num':num},
                dataType:'json',
                beforeSend:function(){
                    layer.load(0, {shade: false});
                },
                success:function(msg){
                    // var aa = eval(msg);  
                    // console.log(msg);
                    if (msg != 2 && msg != 3) {
                        layer.msg('修改成功!ヾ(o◕∀◕)ﾉ 好棒~', {icon: 1});
                        // $('.t').html(msg);
                    }else{
                        if (msg == 3) {
                            layer.msg('您还什么都没有修改呢┌( ಠ_ಠ)┘ !');
                        }else{
                            if (msg == 2) {
                                layer.msg('修改失败啦 (￣▽￣)"');
                            }
                        }
                    }
                    // if (msg == 1111) {
                    //     layer.msg('已通过!ヾ(o◕∀◕)ﾉ 好棒~', {icon: 1});
                    //     $(obj).parent().html('[审核通过!!]').css({'color':' #7FFF00','font-width':'900'});
                    // }else{
                    //     layer.msg('申请失败,请重新再试!');
                    // }
                },
                complete: function() {
                     layer.closeAll('loading');
                }
            })
     
    }, function(){
        layer.msg(' (｡・`ω´･) 再见');
    });
}


    function h()
    {
        location.href="{:U('Gu/gus')}";
    }




    //导出excel
    function export_excel(){
        location.href="{:U('Export/xdao')}";
    }
       //查看库存已有申请
    function ku(){
        location.href="{:U('Shenp/ku')}";
    }
function guan()
{
    $('#centen').hide();
}

function ctong()
{
    layer.open({
    type: 1,
    title:  ['查看所有通过审批', 'font-size:17px;'],
    skin: 'demo-class', //加上边框
    area: ['350px', '150px'], //宽高
    content: $('#xxx'),
    // btn:'按钮'
    });
}


function ju()
{
    $('#qcenten').toggle();
}


function t()
{
    var id = $('#ddi').text();
    console.log(id);
}

function guan()
{
    $('#qcenten').hide();
}



function xtong(id,obj)
{



    //询问框
    layer.confirm('确定通过么 ( ・◇・)？', {
      btn: ['确定','取消'] //按钮
    }, function(){
         $.ajax({
                url:"{:U('Shenp/xsh')}",
                type: 'post',
                data:{'id':id},
                dataType:'json',
                beforeSend:function(){
                    layer.load(0, {shade: false});
                },
                success:function(msg){
                    if (msg == 1111) {
                        layer.msg('已通过!ヾ(o◕∀◕)ﾉ 好棒~', {icon: 1});
                        $(obj).parent().html('[审核通过!!]').css({'color':' #7FFF00','font-width':'900'});
                        history.go(0); 
                    }else{
                        layer.msg('申请失败,请重新再试!');
                    }
                },
                complete: function() {
                     layer.closeAll('loading');
                }
            })
     
    }, function(){
        layer.msg(' (｡・`ω´･) 再见');
    });






}





function g()
{
     location.href="{:U('Gu/jsuo')}";
}

function yju(id,obj)
{


    
    $(".ii").val(id);
    $('.yyy').show();




}





$(".check-all").click(function () {
            $(".uids").prop("checked", this.checked);
        });
$(".uids").click(function () {
        var option = $(".ids");
        option.each(function (i) {
            if (!this.checked) {
                $(".check-all").prop("checked", false);
                return false;
            } else {
                $(".check-all").prop("checked", true);
            }
        });
    });

$("#submit").click(function () {
            
         //询问框
    layer.confirm('确定通过么 ( ・◇・)？', {
      btn: ['确定','取消'] //按钮
    }, function(){
         $.ajax({
             type: "POST",
             url:"{:U('Shenp/qtong')}",
             data:$('#form').serialize(),// 要提交的表单 
             beforeSend:function(){
                    layer.load(0, {shade: false});
                },
             success: function(msg) {
                if (msg == 1111) {
                    layer.msg('已通过!ヾ(o◕∀◕)ﾉ 好棒~', {icon: 1});
                    history.go(0); 
                }else{
                    layer.msg('申请失败,请重新再试!');
                }
             },
             complete: function() {
                     layer.closeAll('loading');
                }
         });
     
    }, function(){
        layer.msg(' (｡・`ω´･) 再见');
    });   
            
});


$("#jusubmit").click(function () {
         
    //询问框
    layer.confirm('确定提交么 ( ・◇・)？', {
      btn: ['确定','取消'] //按钮
    }, function(){
         $.ajax({
             type: "POST",
             url:"{:U('Shenp/bqju')}",
             data:$('#form').serialize(),// 要提交的表单 
             beforeSend:function(){
                    layer.load(0, {shade: false});
                },
             success: function(msg) {
                if (msg == 1111) {
                    layer.msg('已拒绝!ヾ(o◕∀◕)ﾉ 好棒~', {icon: 1});
                    history.go(0); 
                }else{
                    if (msg == 3333) {
                        layer.msg('请选择要删除的数据!');
                    }else{
                        layer.msg('申请失败,请重新再试!');
                    }
                }
             },
             complete: function() {
                     layer.closeAll('loading');
                }
        });
     
    }, function(){
        layer.msg(' (｡・`ω´･) 再见');
    });
     
            
});




$("#tiju").click(function () {
         
    //询问框
    layer.confirm('确定提交么 ( ・◇・)？', {
      btn: ['确定','取消'] //按钮
    }, function(){
         $.ajax({
             type: "POST",
             url:"{:U('Shenp/bju')}",
             data:$('#formid').serialize(),// 要提交的表单 
             beforeSend:function(){
                    layer.load(0, {shade: false});
                },
             success: function(msg) {
                if (msg == 1111) {
                    layer.msg('已拒绝!ヾ(o◕∀◕)ﾉ 好棒~', {icon: 1});
                    history.go(0); 
                }else{
                    layer.msg('申请失败,请重新再试!');
                }
             },
             complete: function() {
                     layer.closeAll('loading');
                }
        });
     
    }, function(){
        layer.msg(' (｡・`ω´･) 再见');
    });
     
            
});









</script>


</body>

</html>
